<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>

<%@ page import="dao.Order"%>
<%@ page import="dao.Shangji"%>
<%@ page import="dao.Yunjia"%>
<%@ page import="dao.Item"%>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Iterator" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
User user=(User)request.getSession().getAttribute("SESSION_USER");
if(user==null) {
	request.setAttribute("message","未登录");
	request.getRequestDispatcher("error.jsp").forward(request,response);
	return;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/frame.css" rel="stylesheet" type="text/css" />
<link href="css/impromptu.css" rel="stylesheet" type="text/css" />
<title>订单明细</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">


</head>
<script>

</script>
<%
	Order order=(Order)request.getAttribute("orderObj");
	String faerInfo="";
	Yunjia yunjia=order.getYunjia();
	Shangji shangji=order.getShangji();
	if(yunjia!=null) {
		faerInfo=yunjia.getUser().getUserinfo();
	} else if(shangji!=null) {
		faerInfo=shangji.getUser().getUserinfo();
	}
	Set<Item> items=order.getItems();
%>
<body>
<!-- <mytag:logincheck></mytag:logincheck> -->
<!-- 页头 左边栏 -->
<%@ include file="/common/header.jsp" %>
<%@ include file="/common/left-nav.jsp" %>
<script>setLeftFrame(3,1);</script>

<!-- 此处添加本页代码 -->
<div class="mainBlock">
	<div class="mainBlockBody">
		<form action="/orderIdOwn.do" id="form">
		<table class="orderTable" width="100%" height="600px" cellpadding="0" cellspacing="5">
			<tr height="5%">
				<th>订单明细</th>
				<td colspan="2">提交日期:<%=order.getSubmitdate().toString().substring(0,19) %></td>
				<td>审核状态:
				<%String orderStatus=order.getOrderstatus();
				  if(orderStatus.toLowerCase().equals("pending")){%>
				  <%="审核中" %>
				  <%} else if(orderStatus.toLowerCase().equals("approved")) {%>
				  <%="通过" %>
				  <%} else if(orderStatus.toLowerCase().equals("deny")) {%>
				  <%="未通过" %>
				  <%} %>
				</td>	
			</tr>
			<tr height="15%">
				<td width="20%">SHIPPER/发货人：</td><td colspan="2"><textarea cols="20" rows="3" readonly="readonly"><%=faerInfo %></textarea></td>
				<td colspan="2" style="vertical-align:top;">B/L运单号码：<br/><br/>
					<input type="text" value="<%=order.getOrdercode() %>" readonly="readonly" size="25"/>
				</td>
			</tr>
			<tr height="15%">
				<td>CONSINEE/收货人：</td><td colspan="2"><textarea cols="20" rows="3" readonly="readonly"><%=order.getConsineeinfo() %></textarea></td>
				<td colspan="2" rowspan="3" style="vertical-align:top;">委托人资料（联系信息）<br/>
					<textarea cols="20" rows="10" readonly="readonly" style="margin:0px;"><%=user.getUserinfo()+"\n联系方式:"+user.getTelephone() %></textarea>
				</td>
			</tr>
			<tr height="15%">
				<td>NOTIFY/通知人：</td><td colspan="2"><textarea cols="20" rows="3" readonly="readonly"><%=order.getNotifyinfo() %></textarea></td>
			</tr>
			<%if(yunjia!=null) {%>
			<tr height="10%"><td colspan="3" style="font-size:15px;">
				POL/装运地：<input type="text" value="<%=yunjia.getAddressByStartaddressid().getFullcninfo() %>" readonly="readonly" size="50"><br>
				POD/目的地：<input type="text" value="<%=yunjia.getAddressByEndaddressid().getFullcninfo() %>" readonly="readonly" size="50"></td>
			</tr>
			<%} else if(shangji!=null) {%>
			<tr height="10%"><td colspan="3">
				商机:<%=shangji.getShangjititle() %></td>
			</tr>
			<%} %>
			<tr height="30%"><td colspan="5">
					<table width="100%" cellpadding="2" cellspacing="0" style="margin:0px;">
						<tr><td colspan="5" style="border:0px;">发货明细</td></tr>
						<tr>
							<td style="border:0px;border-bottom:1px solid #000;">唛头/REMARK</td>
							<td style="border:0px;border-bottom:1px solid #000;"> 件数/CTNS</td>
							<td style="border:0px;border-bottom:1px solid #000;">货物品名/COMMODUTY </td>
							<td style="border:0px;border-bottom:1px solid #000;">体积/CBM</td>
							<td style="border:0px;border-bottom:1px solid #000;">重量</td>
						</tr>
						<%for(Iterator it = items.iterator(); it.hasNext();) {
							Item temp=(Item)it.next();
						%>
						<tr height="30px">
							<td width="30%"><input type="text" value="<%=temp.getMarkinfo()==null?"":temp.getMarkinfo() %>" readonly="readonly" size="30"></td>
							<td width="10%"><input type="text" value="<%=temp.getItemnumber() %>" readonly="readonly" size="8"></td>
							<td width="40%"><input type="text" value="<%=temp.getItemname() %>" readonly="readonly" size="45"></td>
							<td width="10%"><input type="text" value="<%=temp.getItemsize() %>" readonly="readonly" size="8"></td>
							<td width="10%"><input type="text" value="<%=temp.getItemweight() %>" readonly="readonly" size="8"></td>
						</tr>
						<%} %>
						<tr height="25px">
							<td><b>总计</b></td>
							<td><input type="text" value="<%=order.getTotalnum() %>" readonly="readonly" size="8"></td>
							<td></td>
							<td><input type="text" value="<%=order.getTotalsize() %>" readonly="readonly" size="8"></td>
							<td><input type="text" value="<%=order.getTotalweight() %>" readonly="readonly" size="8"></td>
						</tr>						

					</table>
			</td></tr>
			<%if(yunjia!=null) {%>
			<tr height="10%"><td colspan="3" style="font-size:15px;">运费：
				<%=yunjia.getBizhong1()+":"+yunjia.getPrice1()+"/"+yunjia.getYunshuunit1() %>
				
				<%if(yunjia.getPrice2()!=null && yunjia.getPrice2()!=0) {%>
				<%=","+yunjia.getBizhong2()+":"+yunjia.getPrice2()+"/"+yunjia.getYunshuunit2() %>
				<%} %>
				
				<%if(yunjia.getPrice3()!=null && yunjia.getPrice3()!=0) {%>
				<%=","+yunjia.getBizhong3()+":"+yunjia.getPrice3()+"/"+yunjia.getYunshuunit3() %>
				<%} %>
							
				<%if(yunjia.getPrice4()!=null && yunjia.getPrice4()!=0) {%>
				<%="<br>"+yunjia.getBizhong4()+":"+yunjia.getPrice4()+"/"+yunjia.getYunshuunit4() %>
				<%} %>
				
				<%if(yunjia.getPrice5()!=null && yunjia.getPrice5()!=0) {%>
				<%=","+yunjia.getBizhong5()+":"+yunjia.getPrice5()+"/"+yunjia.getYunshuunit5() %>
				<%} %>
				，总运费：<%=order.getTotalprice() %></td>
				<td colspan="2"  style="font-size:15px;">备注：<br><input type="text" value="<%=order.getOrderinfo() %>" readonly="readonly" size="40"></td>
			</tr>
			<%} else if(shangji!=null) {%>
				<tr height="10%">
					<td colspan="2" style="font-size:15px;">总运费：<%=order.getTotalprice() %></td>
					<td colspan="3"  style="font-size:15px;">备注：<input type="text" value="<%=order.getOrderinfo() %>" readonly="readonly" style="width:60;border:0px;"></td>
				</tr>
			<%} %>
		</table>
		</form>
	</div>
</div>

<!-- 页脚 -->
<%@ include file="/common/footer.jsp" %>
</body>
</html>